/*****************************************************\
* Copyright (c) 2020 The game2d Authors. All rights reserved.
  Use of this source code is governed by a BSD-style license that can be
  found in the LICENSE file.

* Author:         dzlua - https://gitee.com/dzlua/game2d.git
* Email:          505544956@qq.com
* FileName:       utils/colormap.cc
* Create Time:    2020/03/21 11:38:52
* Description:    /
\****************************************************/
#include <string.h>

namespace g2d {
namespace utils {
  bool colormap_find(const char *k, unsigned int &v) {
    if (!k || !*k) return false;
    if (0 == strcmp(k, "aliceblue")) {
      v = 0xF0F8FF; return true;
    }
    if (0 == strcmp(k, "antiquewhite")) {
      v = 0xFAEBD7; return true;
    }
    if (0 == strcmp(k, "aqua")) {
      v = 0x00FFFF; return true;
    }
    if (0 == strcmp(k, "aquamarine")) {
      v = 0x7FFFD4; return true;
    }
    if (0 == strcmp(k, "azure")) {
      v = 0xF0FFFF; return true;
    }
    if (0 == strcmp(k, "beige")) {
      v = 0xF5F5DC; return true;
    }
    if (0 == strcmp(k, "bisque")) {
      v = 0xFFE4C4; return true;
    }
    if (0 == strcmp(k, "black")) {
      v = 0x000000; return true;
    }
    if (0 == strcmp(k, "blanchedalmond")) {
      v = 0xFFEBCD; return true;
    }
    if (0 == strcmp(k, "blue")) {
      v = 0x0000FF; return true;
    }
    if (0 == strcmp(k, "blueviolet")) {
      v = 0x8A2BE2; return true;
    }
    if (0 == strcmp(k, "brown")) {
      v = 0xA52A2A; return true;
    }
    if (0 == strcmp(k, "burlywood")) {
      v = 0xDEB887; return true;
    }
    if (0 == strcmp(k, "cadetblue")) {
      v = 0x5F9EA0; return true;
    }
    if (0 == strcmp(k, "chartreuse")) {
      v = 0x7FFF00; return true;
    }
    if (0 == strcmp(k, "chocolate")) {
      v = 0xD2691E; return true;
    }
    if (0 == strcmp(k, "coral")) {
      v = 0xFF7F50; return true;
    }
    if (0 == strcmp(k, "cornflowerblue")) {
      v = 0x6495ED; return true;
    }
    if (0 == strcmp(k, "cornsilk")) {
      v = 0xFFF8DC; return true;
    }
    if (0 == strcmp(k, "crimson")) {
      v = 0xDC143C; return true;
    }
    if (0 == strcmp(k, "cyan")) {
      v = 0x00FFFF; return true;
    }
    if (0 == strcmp(k, "darkblue")) {
      v = 0x00008B; return true;
    }
    if (0 == strcmp(k, "darkcyan")) {
      v = 0x008B8B; return true;
    }
    if (0 == strcmp(k, "darkgoldenrod")) {
      v = 0xB8860B; return true;
    }
    if (0 == strcmp(k, "darkgray")) {
      v = 0xA9A9A9; return true;
    }
    if (0 == strcmp(k, "darkgreen")) {
      v = 0x006400; return true;
    }
    if (0 == strcmp(k, "darkkhaki")) {
      v = 0xBDB76B; return true;
    }
    if (0 == strcmp(k, "darkmagenta")) {
      v = 0x8B008B; return true;
    }
    if (0 == strcmp(k, "darkolivegreen")) {
      v = 0x556B2F; return true;
    }
    if (0 == strcmp(k, "darkorange")) {
      v = 0xFF8C00; return true;
    }
    if (0 == strcmp(k, "darkorchid")) {
      v = 0x9932CC; return true;
    }
    if (0 == strcmp(k, "darkred")) {
      v = 0x8B0000; return true;
    }
    if (0 == strcmp(k, "darksalmon")) {
      v = 0xE9967A; return true;
    }
    if (0 == strcmp(k, "darkseagreen")) {
      v = 0x8FBC8F; return true;
    }
    if (0 == strcmp(k, "darkslateblue")) {
      v = 0x483D8B; return true;
    }
    if (0 == strcmp(k, "darkslategray")) {
      v = 0x2F4F4F; return true;
    }
    if (0 == strcmp(k, "darkturquoise")) {
      v = 0x00CED1; return true;
    }
    if (0 == strcmp(k, "darkviolet")) {
      v = 0x9400D3; return true;
    }
    if (0 == strcmp(k, "deeppink")) {
      v = 0xFF1493; return true;
    }
    if (0 == strcmp(k, "deepskyblue")) {
      v = 0x00BFFF; return true;
    }
    if (0 == strcmp(k, "dimgray")) {
      v = 0x696969; return true;
    }
    if (0 == strcmp(k, "dodgerblue")) {
      v = 0x1E90FF; return true;
    }
    if (0 == strcmp(k, "feldspar")) {
      v = 0xD19275; return true;
    }
    if (0 == strcmp(k, "firebrick")) {
      v = 0xB22222; return true;
    }
    if (0 == strcmp(k, "floralwhite")) {
      v = 0xFFFAF0; return true;
    }
    if (0 == strcmp(k, "forestgreen")) {
      v = 0x228B22; return true;
    }
    if (0 == strcmp(k, "fuchsia")) {
      v = 0xFF00FF; return true;
    }
    if (0 == strcmp(k, "gainsboro")) {
      v = 0xDCDCDC; return true;
    }
    if (0 == strcmp(k, "ghostwhite")) {
      v = 0xF8F8FF; return true;
    }
    if (0 == strcmp(k, "gold")) {
      v = 0xFFD700; return true;
    }
    if (0 == strcmp(k, "goldenrod")) {
      v = 0xDAA520; return true;
    }
    if (0 == strcmp(k, "gray")) {
      v = 0x808080; return true;
    }
    if (0 == strcmp(k, "green")) {
      v = 0x008000; return true;
    }
    if (0 == strcmp(k, "greenyellow")) {
      v = 0xADFF2F; return true;
    }
    if (0 == strcmp(k, "honeydew")) {
      v = 0xF0FFF0; return true;
    }
    if (0 == strcmp(k, "hotpink")) {
      v = 0xFF69B4; return true;
    }
    if (0 == strcmp(k, "indianred")) {
      v = 0xCD5C5C; return true;
    }
    if (0 == strcmp(k, "indigo")) {
      v = 0x4B0082; return true;
    }
    if (0 == strcmp(k, "ivory")) {
      v = 0xFFFFF0; return true;
    }
    if (0 == strcmp(k, "khaki")) {
      v = 0xF0E68C; return true;
    }
    if (0 == strcmp(k, "lavender")) {
      v = 0xE6E6FA; return true;
    }
    if (0 == strcmp(k, "lavenderblush")) {
      v = 0xFFF0F5; return true;
    }
    if (0 == strcmp(k, "lawngreen")) {
      v = 0x7CFC00; return true;
    }
    if (0 == strcmp(k, "lemonchiffon")) {
      v = 0xFFFACD; return true;
    }
    if (0 == strcmp(k, "lightblue")) {
      v = 0xADD8E6; return true;
    }
    if (0 == strcmp(k, "lightcoral")) {
      v = 0xF08080; return true;
    }
    if (0 == strcmp(k, "lightcyan")) {
      v = 0xE0FFFF; return true;
    }
    if (0 == strcmp(k, "lightgoldenrodyellow")) {
      v = 0xFAFAD2; return true;
    }
    if (0 == strcmp(k, "lightgrey")) {
      v = 0xD3D3D3; return true;
    }
    if (0 == strcmp(k, "lightgreen")) {
      v = 0x90EE90; return true;
    }
    if (0 == strcmp(k, "lightpink")) {
      v = 0xFFB6C1; return true;
    }
    if (0 == strcmp(k, "lightsalmon")) {
      v = 0xFFA07A; return true;
    }
    if (0 == strcmp(k, "lightseagreen")) {
      v = 0x20B2AA; return true;
    }
    if (0 == strcmp(k, "lightskyblue")) {
      v = 0x87CEFA; return true;
    }
    if (0 == strcmp(k, "lightslateblue")) {
      v = 0x8470FF; return true;
    }
    if (0 == strcmp(k, "lightslategray")) {
      v = 0x778899; return true;
    }
    if (0 == strcmp(k, "lightsteelblue")) {
      v = 0xB0C4DE; return true;
    }
    if (0 == strcmp(k, "lightyellow")) {
      v = 0xFFFFE0; return true;
    }
    if (0 == strcmp(k, "lime")) {
      v = 0x00FF00; return true;
    }
    if (0 == strcmp(k, "limegreen")) {
      v = 0x32CD32; return true;
    }
    if (0 == strcmp(k, "linen")) {
      v = 0xFAF0E6; return true;
    }
    if (0 == strcmp(k, "magenta")) {
      v = 0xFF00FF; return true;
    }
    if (0 == strcmp(k, "maroon")) {
      v = 0x800000; return true;
    }
    if (0 == strcmp(k, "mediumaquamarine")) {
      v = 0x66CDAA; return true;
    }
    if (0 == strcmp(k, "mediumblue")) {
      v = 0x0000CD; return true;
    }
    if (0 == strcmp(k, "mediumorchid")) {
      v = 0xBA55D3; return true;
    }
    if (0 == strcmp(k, "mediumpurple")) {
      v = 0x9370D8; return true;
    }
    if (0 == strcmp(k, "mediumseagreen")) {
      v = 0x3CB371; return true;
    }
    if (0 == strcmp(k, "mediumslateblue")) {
      v = 0x7B68EE; return true;
    }
    if (0 == strcmp(k, "mediumspringgreen")) {
      v = 0x00FA9A; return true;
    }
    if (0 == strcmp(k, "mediumturquoise")) {
      v = 0x48D1CC; return true;
    }
    if (0 == strcmp(k, "mediumvioletred")) {
      v = 0xC71585; return true;
    }
    if (0 == strcmp(k, "midnightblue")) {
      v = 0x191970; return true;
    }
    if (0 == strcmp(k, "mintcream")) {
      v = 0xF5FFFA; return true;
    }
    if (0 == strcmp(k, "mistyrose")) {
      v = 0xFFE4E1; return true;
    }
    if (0 == strcmp(k, "moccasin")) {
      v = 0xFFE4B5; return true;
    }
    if (0 == strcmp(k, "navajowhite")) {
      v = 0xFFDEAD; return true;
    }
    if (0 == strcmp(k, "navy")) {
      v = 0x000080; return true;
    }
    if (0 == strcmp(k, "oldlace")) {
      v = 0xFDF5E6; return true;
    }
    if (0 == strcmp(k, "olive")) {
      v = 0x808000; return true;
    }
    if (0 == strcmp(k, "olivedrab")) {
      v = 0x6B8E23; return true;
    }
    if (0 == strcmp(k, "orange")) {
      v = 0xFFA500; return true;
    }
    if (0 == strcmp(k, "orangered")) {
      v = 0xFF4500; return true;
    }
    if (0 == strcmp(k, "orchid")) {
      v = 0xDA70D6; return true;
    }
    if (0 == strcmp(k, "palegoldenrod")) {
      v = 0xEEE8AA; return true;
    }
    if (0 == strcmp(k, "palegreen")) {
      v = 0x98FB98; return true;
    }
    if (0 == strcmp(k, "paleturquoise")) {
      v = 0xAFEEEE; return true;
    }
    if (0 == strcmp(k, "palevioletred")) {
      v = 0xD87093; return true;
    }
    if (0 == strcmp(k, "papayawhip")) {
      v = 0xFFEFD5; return true;
    }
    if (0 == strcmp(k, "peachpuff")) {
      v = 0xFFDAB9; return true;
    }
    if (0 == strcmp(k, "peru")) {
      v = 0xCD853F; return true;
    }
    if (0 == strcmp(k, "pink")) {
      v = 0xFFC0CB; return true;
    }
    if (0 == strcmp(k, "plum")) {
      v = 0xDDA0DD; return true;
    }
    if (0 == strcmp(k, "powderblue")) {
      v = 0xB0E0E6; return true;
    }
    if (0 == strcmp(k, "purple")) {
      v = 0x800080; return true;
    }
    if (0 == strcmp(k, "red")) {
      v = 0xFF0000; return true;
    }
    if (0 == strcmp(k, "rosybrown")) {
      v = 0xBC8F8F; return true;
    }
    if (0 == strcmp(k, "royalblue")) {
      v = 0x4169E1; return true;
    }
    if (0 == strcmp(k, "saddlebrown")) {
      v = 0x8B4513; return true;
    }
    if (0 == strcmp(k, "salmon")) {
      v = 0xFA8072; return true;
    }
    if (0 == strcmp(k, "sandybrown")) {
      v = 0xF4A460; return true;
    }
    if (0 == strcmp(k, "seagreen")) {
      v = 0x2E8B57; return true;
    }
    if (0 == strcmp(k, "seashell")) {
      v = 0xFFF5EE; return true;
    }
    if (0 == strcmp(k, "sienna")) {
      v = 0xA0522D; return true;
    }
    if (0 == strcmp(k, "silver")) {
      v = 0xC0C0C0; return true;
    }
    if (0 == strcmp(k, "skyblue")) {
      v = 0x87CEEB; return true;
    }
    if (0 == strcmp(k, "slateblue")) {
      v = 0x6A5ACD; return true;
    }
    if (0 == strcmp(k, "slategray")) {
      v = 0x708090; return true;
    }
    if (0 == strcmp(k, "snow")) {
      v = 0xFFFAFA; return true;
    }
    if (0 == strcmp(k, "springgreen")) {
      v = 0x00FF7F; return true;
    }
    if (0 == strcmp(k, "steelblue")) {
      v = 0x4682B4; return true;
    }
    if (0 == strcmp(k, "tan")) {
      v = 0xD2B48C; return true;
    }
    if (0 == strcmp(k, "teal")) {
      v = 0x008080; return true;
    }
    if (0 == strcmp(k, "thistle")) {
      v = 0xD8BFD8; return true;
    }
    if (0 == strcmp(k, "tomato")) {
      v = 0xFF6347; return true;
    }
    if (0 == strcmp(k, "turquoise")) {
      v = 0x40E0D0; return true;
    }
    if (0 == strcmp(k, "violet")) {
      v = 0xEE82EE; return true;
    }
    if (0 == strcmp(k, "violetred")) {
      v = 0xD02090; return true;
    }
    if (0 == strcmp(k, "wheat")) {
      v = 0xF5DEB3; return true;
    }
    if (0 == strcmp(k, "white")) {
      v = 0xFFFFFF; return true;
    }
    if (0 == strcmp(k, "whitesmoke")) {
      v = 0xF5F5F5; return true;
    }
    if (0 == strcmp(k, "yellow")) {
      v = 0xFFFF00; return true;
    }
    if (0 == strcmp(k, "yellowgreen")) {
      v = 0x9ACD32; return true;
    }
    return false;
  }
} // end namespace utils
} // end namespace g2d